package com.studyroom.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.studyroom.entity.Reservation;
import com.studyroom.dto.SearchDTO;
import com.studyroom.vo.ReservationVO;

import java.time.LocalDateTime;
import java.util.List;

public interface ReservationService extends IService<Reservation> {
    // 管理端方法
    IPage<Reservation> search(SearchDTO params);
    boolean endReservation(Long id);
    
    // 用户端方法
    Page<Reservation> getMyReservations(String username, Integer status, Page<Reservation> page);
    Reservation createReservation(String username, Reservation reservation);
    void cancelReservation(String username, Long id);
    boolean deleteReservation(Long id);

    /**
     * 获取用户在指定时间段内的预约冲突
     */
    List<ReservationVO> getUserConflictReservations(Long userId, LocalDateTime startTime,
                                                    LocalDateTime endTime, List<Integer> statusList);

    Integer getUserCancelledCountLastWeek(String username);
} 